{% load static %}

<div class="chat-right">
            <div class="container">
                {% for message in messages %}
                	{% if message.sender.username == username %}
                        <div class="message-container myself">
                            <img src="/static/media/{{ receiver.cover }}" alt="user头像" class="user-avatar">
                            <div class="message-bubble-right">
                                {{ message.content }}
                            </div>
                        </div>
                        <div style="font-size: small;color:gray;margin-left: 700px;">
                                {{ message.sent_at }}
                        </div>

                    {% else %}
                        <div class="target-user">
                            <img src="/static/media/{{ receiver.cover }}" alt="sender头像" class="user-avatar">
                            <div class="send-msg message-bubble-left">
                                {{ message.content }}
                            </div>
                        </div>
                        <div style="font-size: small;color: gray;margin-left:100px">
                               {{ message.sent_at }}
                        </div>
                    {% endif %}
                {% empty %}
                    {% if senders %}
                    	<p style="padding: 10px;color: gray;">还没跟他聊过天哦~~</p>
                    {% endif %}

                {% endfor %}
            </div>
            <div class="messaging">
                <div class="insert">
                    <button class="image-btn" title="插入图片"><img src="{% static 'images/pic.png' %}" alt=""></button>
                </div>

                <div class="txt">
                    <form method="post">
                        {% csrf_token %}
                        <textarea id="message" name="message" class="message" rows="5" placeholder="请输入消息..."></textarea>
                        <input type="submit" value="发送" class="sendBtn">
                    </form>
                </div>
            </div>
        </div>
<div>{{ mistake }}</div>

{#<script src="{% static 'js/chat.js' %}"></script>#}